********************DATA PREP********************
cd "C:\RCFS Data"
set more off

use "SIXout_p.dta", clear
replace sim=sim+100
append using "SIXout_v.dta"
replace sim=sim+100
append using "SIXout_l.dta"
replace sim=sim+100
append using "SIXout_i.dta"
replace sim=sim+100
append using "SIXout_d.dta"
replace sim=sim+100
append using "SIXout_c.dta"
replace sim=sim+100
append using "SIXout_p ffe.dta"
replace sim=sim+100
append using "SIXout_v ffe.dta"
replace sim=sim+100
append using "SIXout_l ffe.dta"
replace sim=sim+100
append using "SIXout_i ffe.dta"
replace sim=sim+100
append using "SIXout_d ffe.dta"
replace sim=sim+100
append using "SIXout_c ffe.dta"
replace sim=sim+100

gen sd2sd=abs(coeff*expvarsd/depvarsd)
gen sd2mean=abs(coeff*expvarsd/depvarmean)
gen iqr2sd=abs(coeff*(expvarp75-expvarp25)/depvarsd)
gen iqr2mean=abs(coeff*(expvarp75-expvarp25)/depvarmean)

collapse (max) sd2sd_max=sd2sd sd2mean_max=sd2mean iqr2sd_max=iqr2sd iqr2mean_max=iqr2mean, by(sim)

replace sd2mean_max=1 if sd2mean_max>1

gen neg_sd2sd_max=-sd2sd_max
cumul neg_sd2sd_max, gen(sd2sd_freq)

gen neg_sd2mean_max=-sd2mean_max
cumul neg_sd2mean_max, gen(sd2mean_freq)

replace sd2mean_freq=sd2mean_freq*100
replace sd2sd_freq=sd2sd_freq*100

line sd2mean_freq sd2mean_max, sort xtitle("Max economic significance (across methodologies)") ytitle("Percent") xscale(range(0 1)) || line sd2sd_freq sd2sd_max, sort lpattern(dash) title("Panel A: Δy for a one-s.d. Δx") subtitle("Normally distributed explanatory variables") legend(order(1 "Scaled by mean of y" 2 "Scaled by s.d. of y" ))


replace iqr2mean_max=1 if iqr2mean_max>1

gen neg_iqr2sd_max=-iqr2sd_max
cumul neg_iqr2sd_max, gen(iqr2sd_freq)

gen neg_iqr2mean_max=-iqr2mean_max
cumul neg_iqr2mean_max, gen(iqr2mean_freq)

replace iqr2mean_freq=iqr2mean_freq*100
replace iqr2sd_freq=iqr2sd_freq*100

line iqr2mean_freq iqr2mean_max, sort xtitle("Max economic significance (across methodologies)") ytitle("Percent") xscale(range(0 1)) || line iqr2sd_freq iqr2sd_max, sort lpattern(dash) title("Panel B: Δy for a one-IQR Δx") subtitle("Normally distributed explanatory variables") legend(order(1 "Scaled by mean of y" 2 "Scaled by s.d. of y" ))

